# -*- coding:utf-8 -*-
import os
import re
import json

from modules import gossip_robot,medical_robot,classifier
from utils.json_utils import dump_user_dialogue_context,load_user_dialogue_context


if __name__ == '__main__':
	while True:
		user_msg = input("张三:")
		user_msg = user_msg.encode('utf-8').decode('utf-8')
		NickName = "张三"
		user_intent = classifier(user_msg)
		# print(user_intent)

		if user_intent in ["greet","goodbye","deny","isbot"]:
			reply = gossip_robot(user_intent)
		elif user_intent == "accept":
			reply = load_user_dialogue_context(NickName)
			reply = reply.get("choice_answer")
		else:
			reply = medical_robot(user_msg,NickName)
			if reply["slot_values"]:
				dump_user_dialogue_context(NickName,reply)
			reply = reply.get("replay_answer")
		# print(reply)
		print("机器人:" + reply)

